<template>
	<view>
		<view class="usersearch">
			<u-search placeholder="请输入搜索内容" v-model="keyword" @custom="usersearchclick(keyword)"></u-search>
		</view>
		<u-dropdown>
			<u-dropdown-item v-model="value1" title="会员等级" :options="options1" @change="change1(value1)"></u-dropdown-item>
			<u-dropdown-item v-model="value2" title="押金状态" :options="options2" @change="change2(value2)"></u-dropdown-item>
			<u-dropdown-item v-model="value3" title="会员有效期" :options="options3" @change="change3(value3)"></u-dropdown-item>
		</u-dropdown>
		<view class="userlist">
			<view class="useritem" v-for="(item,index) in userinfolist" :key="index" @click="usereditclick(item.id)">
				<image :src="item.img" mode=""></image>
				<view class="useritem_content">
					<view class="useritem_title">
						<text>{{item.name}}</text>
						<text>{{item.grade}}会员</text>
					</view>
					<view class="useritem_member">
						会员到期：{{item.endtime}}
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',
				value1: 1,
				value2: "",
				value3: "",
				options1: [{
						label: '默认排序',
						value: 1,
					},
					{
						label: '由高到低',
						value: 2,
					},
					{
						label: '由低到高',
						value: 3,
					}
				],
				options2: [{
						label: '已归还',
						value: 1,
					},
					{
						label: '未归还',
						value: 2,
					},
				],
				options3: [{
						label: '已过期',
						value: 1,
					},
					{
						label: '未过期',
						value: 2,
					},
				],
				userinfolist:[
					{id:1,img:"../../static/image/mytx.jpeg",name:"一秋",endtime:"2021-09-10",grade:"一级"},
					{id:2,img:"../../static/image/mytx.jpeg",name:"一秋",endtime:"2021-09-10",grade:"一级"},
					{id:3,img:"../../static/image/mytx.jpeg",name:"一秋",endtime:"2021-09-10",grade:"一级"},
					{id:4,img:"../../static/image/mytx.jpeg",name:"一秋",endtime:"2021-09-10",grade:"一级"},
					{id:5,img:"../../static/image/mytx.jpeg",name:"一秋",endtime:"2021-09-10",grade:"一级"},
					{id:6,img:"../../static/image/mytx.jpeg",name:"一秋",endtime:"2021-09-10",grade:"一级"},
				]
			}
		},
		methods: {
			//搜索
			usersearchclick(keyword){
				console.log(keyword)
			},
			//筛选
			change1(val){
				this.options1.map((item)=>{
					if(item.value == val){
						console.log(item.label)
					}
				})
			},
			change2(val){
				this.options2.map((item)=>{
					if(item.value == val){
						console.log(item.label)
					}
				})
			},
			change3(val){
				this.options3.map((item)=>{
					if(item.value == val){
						console.log(item.label)
					}
				})
			},
			//跳转会员信息详情
			usereditclick(id){
				uni.navigateTo({
					url:"../userinfo_edit/userinfo_edit?id="+id
				})
			}
		}
	}
</script>

<style>
.usersearch{
	width: 90%;
	margin: 2% 5%;
}
.u-flex{
	display: flex;
}
.userlist{
	width: 90%;
	margin: 2% 5%;
}
.useritem{
	display: flex;
	align-items: center;
	border-bottom: 1rpx solid #eaeaea;
	padding: 4% 0;
}
.useritem image{
	width: 120rpx;
	height: 120rpx;
	border-radius: 120rpx;
	margin-right: 20rpx;
}
.useritem_content{
	flex: 1;
	height: 120rpx;
}
.useritem_title{
	font-size: 36rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.useritem_member{
	font-size: 28rpx;
	margin-top: 20rpx;
	color: #6d6d6d;
}
.useritem_title text:nth-child(1){
	
}
.useritem_title text:nth-child(2){
	font-size: 28rpx;
	color: #f9b800;
}
</style>
